package fr.lelouet.tests.rmi;

import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;

import fr.lelouet.tests.rmi.Controler.StringHandler;
import fr.lelouet.tests.rmi.impl.StringHandlerImpl;

public class LaunchClient {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			Registry reg = LocateRegistry.getRegistry(LaunchServer.RMIPORT);
			Controler c = (Controler) reg.lookup(LaunchServer.RMINAME);
			c.setHandler((StringHandler) UnicastRemoteObject.exportObject(
					new StringHandlerImpl(), 0));
			c.action();
		} catch (RemoteException e) {
			e.printStackTrace();
		} catch (NotBoundException e) {
			e.printStackTrace();
		}
	}

}
